import QtQuick 2.0
import QtQuick.Layouts 1.14
import '../component'

Item {
    id:root
    property string checkBoxTitle: ''
    property var childItems: []

    signal shootMsg(string msg)

    Rectangle{
        radius: 4
        anchors.fill: parent
        Layout.topMargin: 32
        Layout.bottomMargin: 15
        Layout.alignment:Qt.AlignHCenter | Qt.AlignCenter

        ColumnLayout{
            anchors.fill: parent
            anchors.bottomMargin: 5
            Text {
                id: sizetTitle
                text: root.checkBoxTitle
                font.pixelSize: 24
                font.bold: true
                Layout.alignment:  Qt.AlignCenter
            }

            Rectangle{
                 Layout.fillWidth : true
                 height: 1
                 color: '#C6C6C6'
            }

            Rectangle{
                id:multiCheckBox
                 Layout.fillWidth : true
                 Layout.fillHeight : true
                 property  int currrentItemInx : 0
                 RowLayout{
                     anchors.fill: parent
                     spacing: 0

                     Repeater{
                         model: root.childItems
                         ExBaseCheckBox{
                             id:selfItem
                             width: 150
                             height: 48
                             isjoinGroup: true
                             currentInx: index
                             checked: multiCheckBox.currrentItemInx === index
                             itemText: modelData
                             Layout.alignment:Qt.AlignHCenter | Qt.AlignCenter

                             onClicked1:{
                                multiCheckBox.currrentItemInx = index
                                root.shootMsg(modelData);
                                if(checked){
                                    selfItem.reClicked();
                                }
                             }
                         }
                     }
                 }
            }
        }
    }
}
